home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / software-center / software-center next >
Encoding:
Text File  |  2009-10-26  |  2.4 KB  |  83 lines

  1. #!/usr/bin/python
  2. # Copyright (C) 2009 Canonical
  3. #
  4. # Authors:
  5. #  Michael Vogt
  6. #
  7. # This program is free software; you can redistribute it and/or modify it under
  8. # the terms of the GNU General Public License as published by the Free Software
  9. # Foundation; version 3.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU General Public License along with
  17. # this program; if not, write to the Free Software Foundation, Inc.,
  18. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19.  
  20. # don't change this, gst is later loaded by something and gets 
  21. # rather upset if pygst.require was not called
  22. #
  23. # thread init is also required otherwise both gst and webkit are unhappy
  24. # <magic>
  25. import pygtk
  26. pygtk.require ("2.0")
  27. import gobject
  28. gobject.threads_init()
  29. import gtk
  30. try:
  31.     import pygst
  32.     pygst.require ("0.10")
  33.     import gst
  34. except:
  35.     pass
  36. # </magic>
  37.  
  38. import gettext
  39. import logging
  40. import os
  41.  
  42. from softwarecenter.enums import *
  43. from softwarecenter.version import *
  44.  
  45. from optparse import OptionParser
  46.  
  47. if __name__ == "__main__":
  48.  
  49.     parser = OptionParser("usage: %prog [options] package", 
  50.                           version="%prog "+VERSION)
  51.     parser.add_option("--debug", dest="debug", action="store_true",
  52.                       help="enable debug mode", default=False)
  53.     parser.add_option("--force-rtl", action="store_true",
  54.                       help="force rtl mode (useful for debugging)", 
  55.                       default=False)
  56.     (options, args) = parser.parse_args()
  57.  
  58.     if options.debug:
  59.         logging.basicConfig(level=logging.DEBUG)
  60.     else:
  61.         logging.basicConfig(level=logging.INFO)
  62.     
  63.     # override text direction for testing purposes
  64.     if options.force_rtl:
  65.         gtk.widget_set_default_direction(gtk.TEXT_DIR_RTL)
  66.  
  67.     #logging.basicConfig(level=logging.DEBUG)
  68.     logging.basicConfig(level=logging.INFO)
  69.  
  70.     if os.path.exists("./data/ui/SoftwareCenter.ui"):
  71.         logging.info("Using data (UI, xapian) from current dir")
  72.         datadir = "./data"
  73.         xapian_base_path = datadir
  74.     else:
  75.         datadir = "/usr/share/software-center/"
  76.         xapian_base_path = XAPIAN_BASE_PATH
  77.     
  78.     from softwarecenter.app import SoftwareCenterApp
  79.     
  80.     app = SoftwareCenterApp(datadir, xapian_base_path)
  81.     app.run()
  82.  
  83.